package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BCommentsMapper;
import com.ruoyi.system.domain.BComments;
import com.ruoyi.system.service.IBCommentsService;

/**
 * 评论Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-03
 */
@Service
public class BCommentsServiceImpl implements IBCommentsService 
{
    @Autowired
    private BCommentsMapper bCommentsMapper;

    /**
     * 查询评论
     * 
     * @param id 评论主键
     * @return 评论
     */
    @Override
    public BComments selectBCommentsById(Long id)
    {
        return bCommentsMapper.selectBCommentsById(id);
    }

    /**
     * 查询评论列表
     * 
     * @param bComments 评论
     * @return 评论
     */
    @Override
    public List<BComments> selectBCommentsList(BComments bComments)
    {
        return bCommentsMapper.selectBCommentsList(bComments);
    }

    @Override
    public List<BComments> selectBComments(BComments bComments) {
        return bCommentsMapper.selectBComments(bComments);
    }

    /**
     * 新增评论
     * 
     * @param bComments 评论
     * @return 结果
     */
    @Override
    public int insertBComments(BComments bComments)
    {
        bComments.setCreateTime(DateUtils.getNowDate());
        bComments.setRemark(IpUtils.getIpAddr());
        return bCommentsMapper.insertBComments(bComments);
    }

    /**
     * 修改评论
     * 
     * @param bComments 评论
     * @return 结果
     */
    @Override
    public int updateBComments(BComments bComments)
    {
        return bCommentsMapper.updateBComments(bComments);
    }

    /**
     * 批量删除评论
     * 
     * @param ids 需要删除的评论主键
     * @return 结果
     */
    @Override
    public int deleteBCommentsByIds(Long[] ids)
    {
        return bCommentsMapper.deleteBCommentsByIds(ids);
    }

    /**
     * 删除评论信息
     * 
     * @param id 评论主键
     * @return 结果
     */
    @Override
    public int deleteBCommentsById(Long id)
    {
        return bCommentsMapper.deleteBCommentsById(id);
    }

    @Override
    public int deleteBCommentsByPostsIds(Long[] ids) {
        return bCommentsMapper.deleteBCommentsByPostsIds(ids);
    }
}
